package org.example.Server.model;

import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class BaiduAgentRequest {
    private Message message;
    private String source;
    private final String from = "openapi";
    private String openId = "czy";//默认值

    @Data
    public static class Message {
        private Content content;
    }

    @Data
    public static class Content {
        private String type = "text";  // 默认值
        private Value value;
    }

    @Data
    public static class Value {
        private String showText;  // 唯一需要前端传入的字段
    }

    public static BaiduAgentRequest setBaiduAgentRequest(String showText, String openId) {
        Value value = new Value();
        value.setShowText(showText);

        Content content = new Content();
        content.setValue(value);

        Message message = new Message();
        message.setContent(content);

        BaiduAgentRequest baiduAgentRequest = new BaiduAgentRequest();
        baiduAgentRequest.setMessage(message);
        baiduAgentRequest.setOpenId(openId);

        return baiduAgentRequest;
    }

}